#!bin/bash

#Desc:install mysql and set master or slave
#Author:zhang huan huan 
#Create:2020-09-13
#Update:
#Usage:

#-----------------------variable----------
sourcePath=
basedir=
ipArray=
changeMasterto=
chois=
slaveServerConf="slave.conf"
#-----------------------------------------

sshWithoutCode(){
	echo "设置ssh免密"
	rm -rf ~/.ssh
	ssh-keygen -P "" -f  ~/.ssh/id_rsa
	mv ~/.ssh/id_rsa.pub  ~/.ssh/authorized_keys
	
}
undoWithoutCode(){
	echo "解除ssh免密"
}

unpack(){
	echo "解压源码包"
}

mvdirectory(){
	echo "移动解压好的文件夹"
}

rsyncFiles(){
	echo "同步文件和文件夹"
}

setConffile(){
	echo "设置配置文件"
}

initMySql(){
	eho "MySql初始化。。。"
}

secureInit(){
	echo "MySql安全配置"
}

setMaster(){
	echo "配置主数据库"
}
createSlaveUserAndGrant(){
	echo "创建同步账户和授权"
} 
setSlave(){
	echo "配置从数据库" 
}
 
while :
do
	cat << EOF
☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆
☆☆--------------MySql数据安装，主从，配置--------------☆☆ 
☆☆-------------- 1)主从数据库安装---------------------☆☆
☆☆-------------- 	主数据库配置-----------------------☆☆
☆☆-------------- 	从数据库配置-----------------------☆☆
☆☆-------------- q|Q）退出----------------------------☆☆
☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆ 
EOF
	
	read -p "输入选择项：" chois
	case $chois in
			1) 
			sshWithoutCode
			unpack
			mvdirectory
			rsyncFiles
			setConffile 
			initMySql
			secureInit
			setMaster
			createSlaveUserAndGrant
			setSlave
			undoWithoutCode
			;; 
			q|Q)
			exit
			;;
			*)  
			;;
	esac

done



